<?php
/**
 * Created by PhpStorm.
 * User: wchuang
 * Date: 2016/8/24
 * Time: 16:59
 */


$this->title = '高级特性测试用户列表';
$this->params['breadcrumbs'][] = $this->title;

$createJobUrl = Yii::$app->urlManager->createAbsoluteUrl('lydb-buy/create-buy-job');
?>



<?php if(isset($info) && $info['status'] == 0){?>
	<table class="table .table-condensed">
		<caption>商品详情</caption>
		<thead>
		<tr>
			<th>商品名称</th>
			<th>是否十元商品</th>
			<th>当前已购买数量</th>
			<th>总购买数量</th>
			<th>总期数</th>
			<th>当前期数</th>
			<th>可购买数量</th>
			<th>能否购买</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td style="width: 20%"><?php echo  $info['goodsName']?></td>
			<td><?php echo  $info['istenGoods'] ? '是' : '否'?></td>
			<td><?php echo  $info['CurrentJoinNum']?></td>
			<td><?php echo  $info['AllJoinNum']?></td>
			<td><?php echo  $info['AllNum']?></td>
			<td><?php echo  $info['CurrentNum']?></td>
			<td style="color:red;"><?php echo  $info['AllJoinNum'] - $info['CurrentJoinNum']?></td>
			<td style="color:red;"><?php echo  $info['status'] ? '否' : '是'?></td>
		</tr>
		</tbody>
	</table>
<?php }?>

<form id="myForm" class="" method="post" action="<?=isset($info) && $info['status'] == 0 ?   $createJobUrl : '?lydb-buy/index'?>" style="width: 30%">
	<div class="form-group">
		<label class="sr-only" for="exampleInputAmount"></label>
		<div class="input-group">
			<div class="input-group-addon">商品id</div>
			<input  type="text" value="<?=isset($info['id']) ? $info['id'] : ''?>" name="goodId" class="form-control" placeholder="商品id">

		</div>
	</div>

	<?php if(isset($info) && $info['status'] == 0){?>
		<div class="form-group">
			<label class="sr-only" for="exampleInputAmount"></label>
			<div class="input-group">
				<div class="input-group-addon">购买数量</div>
				<input type="text" name="buyNumber" class="form-control" required  placeholder="需小于可购买数量">
			</div>

<!--			<div class="form-group">-->
<!--				<div class="col-sm-offset-0 col-sm-10">-->
<!--					<div class="checkbox">-->
<!--						<label>-->
<!--							<input name="isBuyOpen" value="1" type="checkbox">是否强制购买至开奖（当实时可购买数量小于需购买数量时候，最后一次购买会失败）-->
<!--						</label>-->
<!--					</div>-->
<!--				</div>-->
<!--			</div>-->
		</div>
	<?php }?>
	<div class="form-group">
		<input type="hidden" name="_csrf" value="<?=Yii::$app->request->csrfToken?>">
		<?php if(isset($info) && $info['status'] == 0){?>
			<button class="submit-click btn btn-primary">创建任务</button>
		<?php } else{?>
			<button type="submit" class="btn btn-primary">查找商品</button>
		<?php } ?>
	</div>
</form>